import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue'),
      hidden:true
    },
    {
      path: '/',
      redirect: '/dashboard',
      name: 'layout',
      component: Layout,
      children:[
        {
          path:'/dashboard',
          name:'dashboard',
          component:()=>import('@/views/dashboard/index.vue'),
          meta:{
            title:'工作台'
          }
        },
        {
          path:'/park',
          name:'park',
          redirect:'/building',
          meta:{
            title:'园区管理'
          },
          children:[
            {
              path:'/building',
              name:'building',
              component:()=>import('@/views/park/building.vue'),
              meta:{
                title:'楼宇管理'
              }
            },
            {
              path:'/enterprise',
              name:'enterprise',
              component:()=>import('@/views/park/enterprise.vue'),
              meta:{
                title:'企业管理'
              }
            }
          ]
        },
        {
          path:'/car',
          name:'Car',
          redirect:'/area',
          meta:{
            title:'行车管理'
          },
          children:[
            {
              path:'/area',
              name:'Area',
              component:()=>import('@/views/car/car-area.vue'),
              meta:{
                title:'区域管理'
              }
            },
            {
              path:'/monthcard',
              name:'MonthCard',
              component:()=>import('@/views/car/monthCard.vue'),
              meta:{
                title:'月卡管理'
              }
            },
            {
              path:'/pay',
              name:'pay',
              component:()=>import('@/views/car/pay.vue'),
              meta:{
                title:'停车缴费管理'
              }
            },
            {
              path:'/billing',
              name:'billing',
              component:()=>import('@/views/car/billing.vue'),
              meta:{
                title:'计费规则管理'
              }
            }
          ]
        },
        {
          path:'/cost',
          name:'cost',
          component:()=>import('@/views/propety/cost.vue'),
          meta:{
            title:'计费规则管理'
          }
        },
        {
          path:'/rod',
          name:'rod',
          redirect:'/manage',
          meta:{
            title:'一体杆管理'
          },
          children:[
            {
              path:'/manage',
              name:'manage',
              component:()=>import('@/views/rod/manage.vue'),
              meta:{
                title:'一体杆管理'
              }
            },
            {
              path:'/warnList',
              name:'warnList',
              component:()=>import('@/views/rod/warnList.vue'),
              meta:{
                title:'告警记录'
              }
            }
          ]
        },
        {
          path:'/system',
          name:'system',
          redirect:'/employee',
          meta:{
            title:'系统管理'
          },
          children:[
            {
              path:'/employee',
              name:'employee',
              component:()=>import('@/views/system/employee.vue'),
              meta:{
                title:'员工管理'
              }
            },
            {
              path:'/permission',
              name:'permission',
              component:()=>import('@/views/system/permission.vue'),
              meta:{
                title:'角色管理'
              }
            }
          ]
        }
      ]
    },

    {
      path:'/404',
      name:'404',
      components:()=>import('@/layout/404.vue'),
      hidden:true
    },
    { path: '/*', redirect: '/404', hidden: true }
  ]
})

export default router
